import threading


class MyThread(threading.Thread):
    def __init__(self, thread_id, name):
        threading.Thread.__init__(self)
        self.thread_id = thread_id
        self.name = name

    def run(self):
        print("开始线程：" + self.name)
        print("退出线程：" + self.name)


def func():
    print('start')


if __name__ == '__main__':
    t = []
    t1 = []
    for i in range(5):
        t.append(MyThread(i, f'thread-{i}'))
    for i in t:
        i.start()

    for i in range(5):
        t1.append(threading.Thread(name=f'thread-{i}', target=func))
    for i in t1:
        i.start()
